package com.iking.housekeeping.dao.servicerecord;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import com.github.pagehelper.Page;
import com.iking.housekeeping.entity.servicerecord.ServiceRecord;
import com.iking.housekeeping.httpbean.elderlyres.ElderlyRes;
import com.iking.housekeeping.httpbean.servicerecord.DetilServiceRecord;
import com.iking.housekeeping.httpbean.servicerecord.HttpServiceRecord;
import com.iking.housekeeping.httpbean.servicerecord.HttpVisitedRecord;
import com.iking.housekeeping.httpbean.servicerecord.SelectServiceRecord;
import com.iking.housekeeping.httpbean.servicerecord.ReqServiceRecord;
import com.iking.housekeeping.httpbean.servicerecord.ReqStatisticsBean;

/**
 * 服务记录
 * 
 * @author: gf
 * @date: 2018年4月22日 下午6:30:28
 */
@Mapper
public interface ServiceRecordMapper {

	/**
	 * 根据id删除服务记录
	 * 
	 * @param fId
	 * @return
	 */
	int deleteByPrimaryKey(String fId);

	/**
	 * 批量删除服务记录
	 * 
	 * @return List<String> 记录id
	 * @author gf
	 */
	int deleteBatch(List<String> list);

	/**
	 *根据服务记录id查询正在进行的服务记录
	 *
	 * @return List<String> 记录id
	 */
	List<String> selectState(List<String> list);

	/**
	 * 添加服务记录
	 * 
	 * @param record
	 * @return
	 */
	int insert(ServiceRecord record);

	/**
	 * 添加服务记录
	 * 
	 * @param record
	 * @return
	 */
	int insertSelective(ServiceRecord record);

	/**
	 * 根据id查看服务记录
	 * 
	 * @param fId
	 * @return
	 */
	ServiceRecord selectByPrimaryKey(String fId);

	/**
	 * 更新服务记录
	 * 
	 * @param record
	 * @return
	 */
	int updateByPrimaryKeySelective(ServiceRecord record);

	/**
	 * 更新服务记录
	 * 
	 * @param record
	 * @return
	 */
	int updateByPrimaryKey(ServiceRecord record);

	/**
	 * 分页查询
	 * 
	 * @return Page<Service>
	 * @author gf
	 */
	Page<HttpServiceRecord> selectByPage(SelectServiceRecord selectServiceRecord);

	/**
	 * 查询导出的服务记录
	 *
	 * @return Page<Service>
	 */
	 List<Map<String,Object>> selectByPage_hash(SelectServiceRecord selectServiceRecord);
	/**
	 * 查询导出老人台账记录
	 *
	 * @return Page<Service>
	 */
	 List<Map<String,Object>>exportElderlyAccountInfo(SelectServiceRecord selectServiceRecord);

	/**
	 * 查询老人台账记录的时间，项目和服务人员
	 *
	 * @return List<String>
	 */
	SelectServiceRecord exportAnyInfo(SelectServiceRecord selectServiceRecord);
	/**
	 * 通过老人Id查询服务记录
	 * 
	 * @param fElderly
	 * @return List<ServiceRecord>
	 * @author gf
	 */
	List<ServiceRecord> selectByElderlyId(String fElderly);

	/**
	 * 通过服务人员ID查询所有记录
	 * 
	 * @param fServiceStaff
	 * @return List<ServiceRecord>
	 * @author gf
	 */
	List<ServiceRecord> selectByStaffId(String fServiceStaff);

	/**
	 * 通过服务人员id统计记录
	 * 
	 * @param fServiceStaff
	 * @return int
	 * @author gf
	 */
	int getCount(String fServiceStaff);

	/**
	 * 查询
	 * 
	 * @Description:
	 * @author:CGZ
	 * @param reqServiceRecord
	 * @return
	 */
	ServiceRecord selectServiceRecord(ReqServiceRecord reqServiceRecord);

	/**
	 * 开始服务
	 * 
	 * @author 秦
	 * @param record
	 * @return
	 */
	int updateByPrimaryKeySelectiveOld(ServiceRecord record);

	// 查询服务人员的当前服务
	ElderlyRes selectCurrentService(@Param("staffId") String staffId);

	/**
	 * 回访
	 * 
	 * @return List<HttpVisitedRecord>
	 * @author gfss
	 */
	List<HttpVisitedRecord> visitedRecord(HttpVisitedRecord httpVisitedRecord);

	/**
	 * 根据服务id查询服务信息
	 * 
	 * @param fId
	 * @return
	 */
	DetilServiceRecord selectServiceRecords(String fId);
	/**
	 * 
	 * @Description:查询总订单数
	 * @author:CGZ
	 * @param reqStatisticsBean 
	 * @return
	 */
	Integer selectTotal(ReqStatisticsBean reqStatisticsBean);
	/**
	 * 
	 * @Description:查询未完成订单数
	 * @author:CGZ
	 * @param reqStatisticsBean 
	 * @return
	 */
	Integer selectUndone(ReqStatisticsBean reqStatisticsBean);
	/**
	 * 
	 * @Description:查询已完成订单数
	 * @author:CGZ
	 * @param reqStatisticsBean 
	 * @return
	 */
	Integer selectCompleted(ReqStatisticsBean reqStatisticsBean);
}
